#ifndef PERSONAL_SPACE_H
#define PERSONAL_SPACE_H

#include <QWidget>
#include <windows.h>
#include <windowsx.h>
#include <QMouseEvent>
#include <QNetworkAccessManager>
#include "QNetworkRequest"
#include "QNetworkReply"
#include "person.h"
#include "itemwidget.h"
#include "itemwidgetpicture.h"

QT_BEGIN_NAMESPACE
namespace Ui { class Personal_Space; }
QT_END_NAMESPACE

class Personal_Space : public QWidget
{
    Q_OBJECT

public:
    Personal_Space(QWidget *parent = nullptr, Person * user = nullptr);
    ~Personal_Space();
    void setting();
    void tableWidget();

    void updateDate();

    friend class ItemWidget;
    friend class ItemWidgetPicture;

protected:
    void mouseMoveEvent(QMouseEvent *event) override;
    void mousePressEvent(QMouseEvent *event) override;

private:
    Ui::Personal_Space *ui;
    QPoint clickPos;

    Person * user = nullptr; //个人信息
    QList<ItemWidget *> VList; //视频指针列表
    QList<ItemWidgetPicture *> PList; //图片指针列表
    QList<ItemWidget *> mainVList; //视频指针列表
    QList<ItemWidgetPicture *> mainPList; //图片指针列表

    //添加Item
    void AddItem(const int &qstrid,const QString& qstrFileName, const QString& qstrPic, const QString& qpath);
    void AddItem1(const int &qstrid,const QString& qstrFileName, const QString& qstrPic);
    void AddItemvedio(const int &qstrid,const QString& qstrFileName, const QString& qstrPic, const QString& qpath);
    void AddItempicture(const int &qstrid,const QString& qstrFileName, const QString& qstrPic);
    QPixmap PixmapToRound(QPixmap src, int radius);


public slots:
    void page_Homepage(); //“主页”槽函数
    void page_Vedios(); //“视频”槽函数
    void page_Pictures(); //“图片”槽函数
    void dealMsg(QNetworkReply *reply); //解析数据给“我的图片”
    void dealMsg1(QNetworkReply *reply); //解析数据给“我的视频”

    void rename_called(int VId, QString VName);
    void prename_called(int PId, QString PName);

signals:
    void remakePersonalSpace();
};
#endif // PERSONAL_SPACE_H
